# Euler Problem 9
# There exists one Pythagorean triple where a + b + c = 1000.  Find the product abc
sum = 1000

import math
#################################
cycles = 50000
cycles = 1
import time
c1 = time.clock()
#for x in xrange(0xFFFFF): pass
for i in range(cycles):
    answer = 0
#################################
### program calculation start ###
#################################

    for a in range(1, sum):
        for b in range(1, sum - a):
            if a**2 + b**2 == (sum - (a+b))**2:
                answer = a*b*(sum - (a+b))
                break
        if answer: break
    
#################################
###  program calculation end  ###
#################################
c2 = time.clock()
if cycles > 1: print "Time spent is %.2f ms" % ((c2-c1)*1000/cycles)
#################################
        
print 'The answer to Problem #9 is >>', (a, b, (sum-a-b)), answer, '<<'

        